[-*Smarty*-]
[-config_load file="default.conf"-]
[-*Load the Language Definitions*-]
[-config_load file="lang.$USER_LANG"-]
[-include file="$TPL_NAME/views/header.html"-]
[-* we want to include out stylesheet for this view*-]
[-fetch file="$TPL_STYLE_PATH/month.css" assign="css"-]
[-eval var=$css-]
[-if $PRINT_VIEW != 1-]
[-*Main Navigation*-]
[-include file="$TPL_NAME/views/global/navigation.html"-]
[-/if-]
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="monthheader">
	<tr align="center">
    	<td nowrap width="100%" align="center" valign="top" class="monthheader">
			<a href="[-$PREV_MONTH_URL-]">&lt;&lt;</a>
    		[-$DATE|pc_date_format:#_PC_DATE_FORMAT_MY#-]
			<a href="[-$NEXT_MONTH_URL-]">&gt;&gt;</a>
		</td>
		[-if $PRINT_VIEW != 1-]
		<td nowrap align="right" valign="top" class="monthheader">
		</td>
		[-/if-]
	</tr>
</table>

<table width="100%" border="0" cellpadding="1" cellspacing="0" class="calcontainer"><tr><td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        [-foreach from=$S_LONG_DAY_NAMES item=day-]
        <td width="14%" align="center" valign="middle" class="daynames">[-$day-]</td>
        [-/foreach-]
    </tr>
    [-* CREATE THE CALENDAR *-]
	[-foreach name=weeks item=days from=$CAL_FORMAT-]
	<tr>
		[-foreach name=days item=date from=$days-]
		[-if $date == $TODAY_DATE-]
			[-assign var="stylesheet" value="monthtoday"-]
		[-elseif ($date < $MONTH_START_DATE || $date > $MONTH_END_DATE)-]
			[-assign var="stylesheet" value="monthoff"-]
		[-else-]
			[-assign var="stylesheet" value="monthon"-]
		[-/if-]
		<td height="75" align="left" valign="top" class="[-$stylesheet-]"
		    onmouseover="this.style.backgroundColor='[-#CellHighlight#-]'"
			onmouseout="this.style.backgroundColor=''"
			onclick="javascript:location.href='[-pc_url action=day date=$date-]';">
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td align="left" valign="top"><a
						href="[-pc_url action=day date=$date-]">[-$date|date_format:"%d"-]</a>
					[-if $smarty.foreach.days.iteration == 1-]
					<a href="[-pc_url action=week date=$date-]">[[-#_PC_MV_WEEK#-]]</a>
					[-/if-]
					</td>
					<td align="right" valign="top">
						[-if $ACCESS_ADD eq true-]
						<a href="[-pc_url action=submit date=$date-]"><img
                 		src="[-$TPL_IMAGE_PATH-]/new.gif" width="10" height="10" border="0" /></a>
						[-/if-]
					</td>
				</tr>
				<tr>
					<td colspan="2" valign="top" align="left">
					[-*sort the events by category so we can make it pretty*-]
					[-pc_sort_events var="S_EVENTS" sort="time" order="asc" value=$A_EVENTS-]
					[-assign var="oldCat" value=""-]
					[-foreach name=events item=event from=$S_EVENTS.$date-]
						[-assign var="cCat" value=$event.catname-]
						[-if $oldCat != $cCat-]
							[-if $smarty.foreach.event.first != true-]
								</div>
							[-/if-]
							<div width="100%" style="padding: 1px; background-color: [-$event.catcolor-];">
								<span style="font-size:10pt;">[-$event.catname-]</span>
							</div>
							<div width="100%" style="padding: 2px; border:solid 1px [-$event.catcolor-];">
						[-/if-]

						[-* Here we determine if the event is an
							all day event or a timed event
							and determine how to display the time *-]
						[-if $event.alldayevent != true-]
							[-if $24HOUR_TIME-]
								[-assign var="timestamp" value=$event.startTime|date_format:#_PC_TIME_FORMAT_24#-]
							[-else-]
								[-assign var="timestamp" value=$event.startTime|date_format:#_PC_TIME_FORMAT_12#-]
							[-/if-]
							[-*assign var="title" value=$event.title|truncate:15:"...":true*-]
							[-assign var="title" value=$event.title|strip_tags-]

						[-else-]
							[-assign var="timestamp" value=""-]
							[-*assign var="title" value=$event.title|truncate:30:"...":true*-]
							[-assign var="title" value=$event.title|strip_tags-]
						[-/if-]
						[-assign var="desc" value=$event.hometext|truncate:255:"..."-]
						[-* Here we start the actual display of the event *-]
						<a style="font-size: 7pt; text-decoration: none;"
						   href="[-pc_url action=detail eid=$event.eid date=$date-]"
						[-pc_popup delay="500"
					               bgcolor="$event[catcolor]"
								   timeout="3600"
								   caption="$timestamp $event[title]"
								   text="$desc"-]>
                    	[-$timestamp-] [-$title-]</a>
						<span style="font-size:7pt;text-decoration:none;">
						[-include file="$TPL_NAME/user/patient_line.html" event=$event show_icons=false show_provider=true show_patient=true -]</span><br />
						[-assign var="oldCat" value=$event.catname-]
						[-if $smarty.foreach.event.last-]
							[-* we need to close out the <div> tag *-]
							</div>
						[-/if-]
					[-/foreach-]
					</td>
				</tr>
			</table>			
		</td>
		[-/foreach-]
	</tr>
	[-/foreach-]
</table>
</td></tr></table>
[-if $PRINT_VIEW != 1-]
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td align="right">
            <a href="[-pc_url action="month" print="true"-]">[-#_PC_THEME_PRINT#-]</a>
        </td>
    </tr>
</table>
[-/if-]
[-*footer*-]
[-include file="$TPL_NAME/views/global/footer.html"-]
[-include file="$TPL_NAME/views/footer.html"-]
